﻿using System;
using System.IO;
using System.Reflection;
using System.Windows;
using Fluffy.WinForms;
using Microsoft.Win32;

namespace Fluffy.Library.Utils
{
	public static class PathUtils
	{
		public static string AppDataPath
		{
			get
			{
				return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), AppConstants.AppName);
			}
		}

		public static string AppBinaryPath
		{
			get
			{
				string assemblyLocation = Assembly.GetExecutingAssembly().Location;
				return Path.GetDirectoryName(assemblyLocation);
			}
		}

		public static string SelectDirectory(string text)
		{
			return DialogHelper.SelectFolder(text);
		}

		public static string SelectFileForSave(string text)
		{
			SaveFileDialog dialog = new SaveFileDialog { Title = text };
			return dialog.ShowDialog(Application.Current.MainWindow).GetValueOrDefault() ? dialog.SafeFileName : string.Empty;
		}
	}
}
